<%@taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="util" uri="/WEB-INF/kdd-util.tld" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<sec:authorize access="isAuthenticated()">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        </head>
        <body>
            <jsp:include page="menu.jsp" />
            <script type="text/javascript">
                $(function() { 
                    var t = $('table#listtable')
                    $("#filter").keyup(function() {
                        $.uiTableFilter( t, this.value );
                    })
                });  
            </script>
            <h6><spring:message code="msg.createresult" /></h6>
            <c:url var="action" value="/researcher/result/add" />
            <form:form class="well notfull form-horizontal" action="${action}" method="POST" modelAttribute="bean">
                <fieldset class="notfullfs">
                    <div class="control-group">
                        <label class="control-label"><spring:message code="msg.method" />:</label>
                        <div class="controls">
                            <input type="text" disabled="true" class="input-xlarge" value="${method.showName}" />
                            <form:hidden path="method" />
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label"><spring:message code="msg.project" />:</label>
                        <div class="controls">
                            <input type="text" disabled="true" class="input-xlarge" value="${project.name}" />
                            <form:hidden path="project" />
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label"><spring:message code="msg.subproject" />:</label>
                        <div class="controls">
                            <input type="text" disabled="true" class="input-xlarge" value="${subproject.name}" />
                            <form:hidden path="subProject" />
                        </div>
                    </div>
                    <div class="control-group">
                        <h5><spring:message code="msg.description" /></h5>
                        <div class="alert-success padding">
                            ${method.description}
                        </div>
                    </div>
                    <div class="control-group">
                        <spring:message code="msg.inputdata" />:<br />
                        <div class="well">
                            <input type="text" id="filter" placeholder="Filter" />
                            <table id="listtable" class="table table-striped table-bordered table-condensed notfulltab">
                                <thead>
                                <th class="delete"><spring:message code="msg.name"/></th>
                                <th><spring:message code="msg.identifier" /></th>
                                <th class="creationdate"><spring:message code="msg.created"/></th>
                                <th class="edit"><spring:message code="msg.check"/></th>
                                </thead>
                                <tbody>
                                    <c:forEach items="${inputs}" var="i">
                                        <c:if test="${util:isInstanceOf(i, 'at.tugraz.hidipic.model.InputDataItem')}">
                                            <tr>
                                                <td><input type="text" name="${i.name}"/></td>
                                                <td><a target="_blank" href="<c:url value='${i.url}' />">${i.title}</a></td>
                                                <td><fmt:formatDate value="${i.created}" pattern="MM/dd/yyyy HH:mm"/></td>
                                                <td> <form:checkbox class="chkbx" path="inputData" value="${i.name}" /></td>
                                            </tr>
                                        </c:if>
                                    </c:forEach>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <util:dynamicconfigform value="${config}" />
                    <div class="form-actions">
                        <button type="submit" class="btn btn-primary"><spring:message code="msg.save" /></button>
                        <button type="reset" class="btn btn-warning"><spring:message code="msg.reset" /></button>
                    </div>
                </fieldset>
            </form:form>
            <jsp:include page="foot.jsp" />
        </sec:authorize>